import java.util.ArrayList;
public class cha {
    public static void main(String[] args) {
        ArrayList<User> list = new ArrayList<>();
        User one = new User("窦文晨", 18, "10001");
        User two = new User("张三", 12, "10002");
        list.add(one);
        list.add(two);
        boolean result = contains(list, "10001");

        System.out.println(result);
    }

    // 修正方法定义的括号
    public static boolean contains(ArrayList<User> list, String id) {
        for (int i = 0; i < list.size(); i++) {
            User user = list.get(i);
            if (user.getId().equals(id)) {
                return true;
            }
        }
        return false;
    }
}
